﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Frontdatabase.Migrations
{
    /// <inheritdoc />
    public partial class 添加分区表和类别表索引 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "Route",
                table: "SubAreas",
                type: "nvarchar(450)",
                nullable: false,
                comment: "页面路由",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldComment: "页面路由");

            migrationBuilder.AlterColumn<string>(
                name: "Route",
                table: "Categories",
                type: "nvarchar(450)",
                nullable: false,
                comment: "页面路由",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldComment: "页面路由");

            migrationBuilder.CreateIndex(
                name: "IX_SubAreas_Route",
                table: "SubAreas",
                column: "Route",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Categories_Route",
                table: "Categories",
                column: "Route",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_SubAreas_Route",
                table: "SubAreas");

            migrationBuilder.DropIndex(
                name: "IX_Categories_Route",
                table: "Categories");

            migrationBuilder.AlterColumn<string>(
                name: "Route",
                table: "SubAreas",
                type: "nvarchar(max)",
                nullable: false,
                comment: "页面路由",
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldComment: "页面路由");

            migrationBuilder.AlterColumn<string>(
                name: "Route",
                table: "Categories",
                type: "nvarchar(max)",
                nullable: false,
                comment: "页面路由",
                oldClrType: typeof(string),
                oldType: "nvarchar(450)",
                oldComment: "页面路由");
        }
    }
}
